<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>物料出库单</title>
    <link rel="stylesheet" type="text/css" href="/static/jquery-easyui-1.3.3/themes/default/easyui.css"></link>
    <link rel="stylesheet" type="text/css" href="/static/jquery-easyui-1.3.3/themes/icon.css"></link>
    <script type="text/javascript" src="/static/jquery-easyui-1.3.3/jquery.min.js"></script>
    <script type="text/javascript" src="/static/jquery-easyui-1.3.3/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="/static/jquery-easyui-1.3.3/locale/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript" src="/static/js/date.js"></script>
    <script type="text/javascript" src="/static/js/print.js"></script>
    <script type="text/javascript">

        var url;
        // 屏蔽右键 变为菜单那
        $(function () {
            $(document).bind('contextmenu', function (e) {
                e.preventDefault();
                $('#tree-0').menu('show', {
                    left: e.pageX,
                    top: e.pageY
                });
            });
        });

        //加载项目tree类别
        function openProjListChoose() {
            console.log()
            $("#projList").dialog("open").dialog("setTitle", "进入项目选择");
            $("#projTree").tree({
                url: '/admin/project/loadProjectTree',
                onLoadSuccess: function (node, data) {
                    $("#projTree").tree('expandAll');
                },
                onDblClick: function (node) {

                },
                //右键选择树形菜单操作
                onContextMenu: function (e, node) { //右键时触发事件                      
                    e.preventDefault(); //阻止浏览器捕获右键事件
                },
                //单击某类别 展示不同详细和按钮选择
                onClick: function (node) {
                    if (node.attributes.state == 2) { // 假如是二级菜单,可以删除
                        $("#projNameList").datagrid('load', {
                            "w_id": node.id
                        });
                    } else if (node.attributes.state == 1) {
                        $("#projNameList").datagrid('load', {
                            "o_id": node.id
                        });
                    }
                }
            });
            loadDataGrid();
        }

        //加载项目数据表格
        function loadDataGrid() {
            $("#projNameList").datagrid({
                //双击事件
                onDblClickRow: function (index, row) {
                    $("#projId").val(row.id);
                    $("#projName").val(row.xiangmumingcheng);
                    $("#projList").dialog("close");
                },
                onRowContextMenu: function (e, rowIndex, rowData) { //右键时触发事件                      
                    e.preventDefault(); //阻止浏览器捕获右键事件
                },
            });
        }

        //加载项目tree类别
        function openDeptListChoose() {
            $("#deptList").dialog("open").dialog("setTitle", "选择发料单位");
            $("#deptTree").tree({
                url: '/admin/bumen/loadBumenTree',
                onLoadSuccess: function (node, data) {
                    $("#deptTree").tree('expandAll');
                },
                onDblClick: function (node) {

                },
                //右键选择树形菜单操作
                onContextMenu: function (e, node) { //右键时触发事件                      
                    e.preventDefault(); //阻止浏览器捕获右键事件
                },
                //单击某类别 展示不同详细和按钮选择
                onClick: function (node) {
                    if (node.attributes.state == 2) { // 假如是二级菜单,可以删除
                        $("#deptNameList").datagrid('load', {
                            "w_id": node.id
                        });
                    } else if (node.attributes.state == 1) {
                        $("#deptNameList").datagrid('load', {
                            "o_id": node.id
                        });
                    }
                }
            });
            loadDeptDataGrid();
        }

        //加载部门数据表格
        function loadDeptDataGrid() {
            $("#deptNameList").datagrid({
                //双击事件
                onDblClickRow: function (index, row) {
                    $("#deptId").val(row.id);
                    $("#deptName").val(row.bumenmingcheng);
                    $("#deptList").dialog("close");
                },
                onRowContextMenu: function (e, rowIndex, rowData) { //右键时触发事件                      
                    e.preventDefault(); //阻止浏览器捕获右键事件
                },
            });
        }

        //加载库房tree类别
        function openStoreListChoose() {
            $("#storeList").dialog("open").dialog("setTitle", "进入仓库选择");
            $("#storeTree").tree({
                url: '/admin/kufang/loadKufangTree',
                onLoadSuccess: function (node, data) {
                    $("#storeTree").tree('expandAll');
                },
                onDblClick: function (node) {

                },
                //右键选择树形菜单操作
                onContextMenu: function (e, node) { //右键时触发事件                      
                    e.preventDefault(); //阻止浏览器捕获右键事件
                },
                //单击某类别 展示不同详细和按钮选择
                onClick: function (node) {
                    if (node.attributes.state == 2) { // 假如是二级菜单,可以删除
                        $("#storeNameList").datagrid('load', {
                            "w_id": node.id
                        });
                    } else if (node.attributes.state == 1) {
                        $("#storeNameList").datagrid('load', {
                            "o_id": node.id
                        });
                    }
                }
            });
            loadKuDataGrid();
        }

        //加载库房数据表格
        function loadKuDataGrid() {
            $("#storeNameList").datagrid({
                //双击事件
                onDblClickRow: function (index, row) {
                    $("#storeId").val(row.id);
                    $("#storeName").val(row.kufangmingcheng);
                    $("#storeList").dialog("close");
                },
                onRowContextMenu: function (e, rowIndex, rowData) { //右键时触发事件                      
                    e.preventDefault(); //阻止浏览器捕获右键事件
                },
            });
        }
        //新三板 stuff up

        // 查询项目
        function searchProj() {
            $("#projNameList").datagrid('load', {
                "xiangmumingcheng": $("#projSearch").val()
            });
        }

        // 查询部门
        function searchDept() {
            $("#deptNameList").datagrid('load', {
                "bumenmingcheng": $("#deptSearch").val()
            })
        }

        //查询库房
        function searchStore() {
            $("#storeNameList").datagrid('load', {
                "kufangmingcheng": $("#storeSearch").val()
            })
        }

        //保存项目选择
        function saveProjChoose() {
            var node = $('#projTree').tree('getSelected'); // 获取选中节点
            $("#projId").val(node.id);
            $("#projName").val(node.text);
            $("#projList").dialog("close");
        }

        //保存部门选择 条目->文本
        function saveDeptChoose() {
            var node = $('#deptTree').tree('getSelected'); // 获取选中节点
            $("#deptId").val(node.id);
            $("#deptName").val(node.text);
            $("#deptList").dialog("close");
        }

        //保存库房选择
        function saveStoreChoose() {
            var node = $('#storeTree').tree('getSelected');
            $("#storeId").val(node.id);
            $("#storeName").val(node.text);
            $("#storeList").dialog("close");
        }
        //3 search 3 save

        function openChukudanDetailsAddDialog() {
            //上层表单 库房选择,仓库,部门选择,input等
            if (!$("#fm6").form("validate")) {
                $.messager.alert("系统提示", "请填写项目班组库房等信息！");
                return;
            }
            $("#dlg").dialog("open").dialog("setTitle", "出库物料选择");
            $("#tree").tree({
                url: '/admin/wuliaoTree/loadWuliaoTree',
                onLoadSuccess: function (node, data) {
                    var rootNode = $("#tree").tree('getRoot');
                    $("#tree").tree('expand', rootNode.target);
                },
                //单击某类别 展示不同详细和按钮选择
                onClick: function (node) {
                    if (node.attributes.state == 2) { // 假如是二级菜单,可以删除
                        $("#dg3").datagrid('load', {
                            "w_id": node.id
                        });
                    } else if (node.attributes.state == 1) {
                        $("#dg3").datagrid('load', {
                            "o_id": node.id
                        });
                    }
                }
            });

        }

        function openChukudanDetailsModifyDialog() {
            $("#saveAndAddNextBuuton").hide();
            var selectedRows = $("#dg").datagrid("getSelections");
            if (selectedRows.length != 1) {
                $.messager.alert("系统提示", "请选择一条出库详细！");
                return;
            }
            var row = selectedRows[0];
            $("#dlg4").dialog("open").dialog("setTitle", "修改出库单物料");
            $("#fm4").form("load", row);
            // $("#chukushuliang").numberbox("setValue", row.chukushuliang);
            // $("#beizhu").val(row.beizhu);
            $("#chukushuliang").focus();
            $("#action").val("modify");
            $("#rowIndex").val($("#dg").datagrid("getRowIndex", row));
        }

        function deleteChukuDetails() {
            var selectedRows = $("#dg").datagrid("getSelections");
            if (selectedRows.length != 1) {
                $.messager.alert("系统提示", "请选择要删除的物料！");
                return;
            }
            $.messager.confirm("系统提示", "您确定要删除这个物料吗？", function (r) {
                if (r) {
                    $('#dg').datagrid('deleteRow', $("#dg").datagrid("getRowIndex", selectedRows[0]));
                    // setReturnListAmount();
                }
            });
        }
        //
        // function setReturnListAmount() {
        //     var rows = $("#dg").datagrid("getRows");
        //     var amount = 0;
        //     for (var i = 0; i < rows.length; i++) {
        //         var row = rows[i];
        //         amount += row.total;
        //     }
        //     $("#amountPayable").val(amount.toFixed(2));
        //     $("#amountPaid").val(amount.toFixed(2));
        // }

        $(document).ready(function () {
            $("#dh").load('/admin/chukudan/getChukuNumber');
        });

        function saveChukuDan() {
            var goodsJson = JSON.stringify($("#dg").datagrid("getData").rows);
            $("#wuliaoChukuDetailsJson").val(goodsJson);
            $("#wuliaochukudanhao").val($("#dh").text());
            if ($("#dg").datagrid("getRows").length == 0) {
                $.messager.alert("系统提示", "请添加出库物料!")
                return;
            }
            if (!$("#fm6").form("validate")) {
                $.messager.alert("系统提示", "请填写必填项!");
                return;
            }
            $.ajax({
                url: "/admin/chukudan/save",
                data: $("#fm6").serialize(),
                type: 'post',
                dataType: 'json',
                success: function (result) {
                    if (result.success) {
                        $.messager.confirm("系统提示", result.msg, function (r) {
                            window.location.reload();
                        })
                    } else {
                        $.messager.alert("系统提示", result.errorInfo);
                    }
                }
            });
        }
        //  物料类别模块管理

        function openGoodsTypeAddDialog() {
            $("#dlg2").dialog("open").dialog("setTitle", "新增物料类别");
        }

        function deleteGoodsType() {
            var node = $('#tree').tree('getSelected'); // 获取选中节点
            var id = node.id;
            $.post("/admin/goodsType/delete", {id: id}, function (result) {
                if (result.success) {
                    $('#tree').tree('reload');
                } else {
                    $.messager.alert("系统提示", "提交失败，请联系管理员！");
                }
                $('#del').linkbutton('disable');
            }, "json");
        }

        function saveGoodsType() {
            var shengoumingcheng = $("#goodsTypeName").val();
            if (!$("#fm").form("validate")) {
                return;
            }
            var node = $('#tree').tree('getSelected'); // 获取选中节点
            var parentId; // 父节点Id
            if (node == null) {
                parentId = 1;
            } else {
                parentId = node.id;
            }
            $.post("/admin/goodsType/save", {'shengoumingcheng': shengoumingcheng, 'p_id': parentId}, function (result) {
                if (result.success) {
                    $('#tree').tree('reload');
                    closeGoodsTypeDialog();
                } else {
                    $.messager.alert("系统提示", "提交失败，请联系管理员！");
                }
            }, "json");
        }

        function closeGoodsTypeDialog() {
            $("#dlg2").dialog("close");
            $("#goodsTypeName").val("");
        }

        function searchGoods() {
            $("#dg3").datagrid('load', {
                "wuliaobianma": $("#s_wuliaobianma").val(),
                "mingchengguige": $("#s_mingchengguige").val()
            });
        }

        function closeGoodsDialog() {
            $("#s_codeOrName").val("");
            $("#dlg").dialog("close");
        }

        function openGoodsChooseDialog() {
            $("#saveAndAddNextBuuton").show();
            var selectedRows = $("#dg3").datagrid("getSelections");
            if (selectedRows.length != 1) {
                $.messager.alert("系统提示", "请选择一个物料！");
                return;
            }
            var row = selectedRows[0];
            $("#dlg4").dialog("open").dialog("setTitle", "出库物料");
            $("#fm4").form("load", row);
            $("#lastReturnPrice").val("￥" + row.lastPurchasingPrice);
            $("#price").numberbox("setValue", row.lastPurchasingPrice);
            $("#num").focus();
            $("#action").val("add");
        }

        function closeGoodsChooseDialog() {
            $("#dlg4").dialog("close");
            resetValue();
        }

        function resetValue() {
            $("#num").numberbox("setValue", "");
            $("#price").val("");
        }

        function saveGoods(type) {
            var action = $("#action").val();
            console.log("action:"+action)
            //出库数量是否填写
            if (!$("#fm5").form("validate")) {
                $.messager.alert("系统提示", "请填写出库量！");
                return;
            }
            //上层表单 库房选择,仓库,部门选择,input等
            if (!$("#fm6").form("validate")) {
                $.messager.alert("系统提示", "请填写项目班组库房等信息！");
                return;
            }
            if (action == "add") {
                console.log("add action")
                var selectedRows = $("#dg3").datagrid("getSelections");
                var row = selectedRows[0];
                var chukushuliang = $("#chukushuliang").numberbox("getValue");
                var chukukufang = $("#storeName").val();
                var beizhu = $("#beizhu_ck").val();
                // var num = $("#num").numberbox("getValue");
                // var total = price * num;
                $('#dg').datagrid('appendRow', {
                    dalei:row.dalei,
                    wuliaobianma: row.wuliaobianma,
                    mingchengguige: row.mingchengguige,
                    kehuishou: row.kehuishou,
                    danwei: row.danwei,
                    chukushuliang: chukushuliang,
                    chukukufang: chukukufang,
                    beizhu:beizhu
                });
            } else if (action == "modify") {
                var rowIndex = $("#rowIndex").val();
                var selectedRows = $("#dg").datagrid("getSelections");
                var row = selectedRows[0];
                var chukushuliang = $("#chukushuliang").numberbox("getValue");
                var chukukufang = $("#storeName").val();
                var beizhu = $("#beizhu_ck").val();
                $('#dg').datagrid('updateRow', {
                    index: rowIndex,
                    row: {
                        dalei:row.dalei,
                        wuliaobianma: row.wuliaobianma,
                        mingchengguige: row.mingchengguige,
                        danwei: row.danwei,
                        chukushuliang: chukushuliang,
                        chukukufang: chukukufang,
                        beizhu:beizhu
                    }
                });
            }
            // setReturnListAmount();
            if (type == 1) {
                closeGoodsDialog();
            }
            closeGoodsChooseDialog();
        }

        $(function () {
            $("#dg").datagrid({
                //之后onLoadSuccess加载这两种方法
                //悬停提示tooltip
                onLoadSuccess: function (data) {
                    $(this).datagrid('tooltip');
                    $(this).datagrid('fixRownumber');
                },
                //双击事件
                onDblClickRow: function (index, row) {
                    $("#saveAndAddNextBuuton").hide();
                    $("#dlg4").dialog("open").dialog("setTitle", "修改出库单物料");
                    $("#fm4").form("load", row);
                    // $("#chukushuliang").numberbox("setValue", row.chukushuliang);
                    // $("#beizhu").val(row.beizhu);
                    $("#chukushuliang").focus();
                    $("#action").val("modify");
                    $("#rowIndex").val($("#dg").datagrid("getRowIndex", row));
                },
                onRowContextMenu: function (e, rowIndex, rowData) { //右键时触发事件                      
                    e.preventDefault(); //阻止浏览器捕获右键事件
                    $(this).datagrid("clearSelections"); //取消所有选中项
                    $(this).datagrid("selectRow", rowIndex); //根据索引选中该行
                    $('#grid-data').menu('show', {
                        left: e.pageX,//在鼠标点击处显示菜单
                        top: e.pageY
                    });
                    e.preventDefault();  //阻止浏览器自带的右键菜单弹出
                },
            });

            $("#dg3").datagrid({
                //之后onLoadSuccess加载这两种方法
                //悬停提示tooltip
                onLoadSuccess: function (data) {
                    $(this).datagrid('tooltip');
                    $(this).datagrid('fixRownumber');
                },
                // 双击事件
                onDblClickRow: function (index, row) {
                    openGoodsChooseDialog();
                    // $("#dlg4").dialog("open").dialog("setTitle","选择21");
                    // $("#fm4").form("load",row);
                    // $("#lastReturnPrice").val("￥"+row.lastPurchasingPrice);
                    // $("#price").numberbox("setValue",row.lastPurchasingPrice);
                    // $("#num").focus();
                }
            });

            //之下为鼠标悬停table上展示单个字段的tooltip
            $.extend($.fn.datagrid.methods, {
                tooltip: function (jq, fields) {
                    return jq.each(function () {
                        var panel = $(this).datagrid('getPanel');
                        if (fields && typeof fields == 'object' && fields.sort) {
                            $.each(fields, function () {
                                var field = this;
                                bindEvent($('.datagrid-body td[field=' + field + '] .datagrid-cell', panel));
                            });
                        } else {
                            bindEvent($(".datagrid-body .datagrid-cell", panel));
                        }
                    });

                    function bindEvent(jqs) {
                        jqs.mouseover(function () {
                            var content = $(this).text();
                            if (content && content != "") {
                                $(this).tooltip({
                                    content: content,
                                    trackMouse: true,
                                    deltaX: 15,
                                    deltaY: -5,
                                    onShow: function () {
                                        $(this).tooltip('tip').css({
                                            backgroundColor: '#f7f5d1',
                                            borderColor: 'black'
                                        });
                                    }
                                }).tooltip('show');
                            }
                        });
                    }
                }
            });

            $.extend($.fn.datagrid.methods, {
                fixRownumber : function (jq) {
                    return jq.each(function () {
                        var panel = $(this).datagrid("getPanel");
                        //获取最后一行的number容器,并拷贝一份
                        var clone = $(".datagrid-cell-rownumber", panel).last().clone();
                        //由于在某些浏览器里面,是不支持获取隐藏元素的宽度,所以取巧一下
                        clone.css({
                            "position" : "absolute",
                            left : -1000
                        }).appendTo("body");
                        var width = clone.width("auto").width();
                        //默认宽度是25,所以只有大于25的时候才进行fix
                        if (width > 25) {
                            //多加5个像素,保持一点边距
                            $(".datagrid-header-rownumber,.datagrid-cell-rownumber", panel).width(width + 5);
                            //修改了宽度之后,需要对容器进行重新计算,所以调用resize
                            $(this).datagrid("resize");
                            //一些清理工作
                            clone.remove();
                            clone = null;
                        } else {
                            //还原成默认状态
                            $(".datagrid-header-rownumber,.datagrid-cell-rownumber", panel).removeAttr("style");
                        }
                    });
                }
            });
        });
    </script>
</head>
<body class="easyui-layout">
<div region="north" style="height: 163px;padding: 10px;border: 0px;padding-top: 20px">
    <fieldset style="border-color: #E7F0FF">
        <legend>出库单号：<span id="dh"></span></legend>
        <form id="fm6" method="post">
            <table cellspacing="8px">
                <tr>
                    <td>
                        <!--供应商：<select class="easyui-combobox"  id="supplierId" name="supplier.id" style="width: 200px;" required=true data-options="required:true,panelHeight:'auto',valueField:'id',textField:'name',url:'/admin/supplier/comboList'"></select>-->
                        项目选择：<input type="text" id="projName" name="xiangmumingcheng" style="width: 90px;"
                                    class="easyui-validatebox"
                                    readonly="readonly" onclick="openProjListChoose()" required="true"/>
                        <input type="hidden" id="projId"/>
                    </td>
                    <td>
                        <!--供应商：<select class="easyui-combobox"  id="supplierId" name="supplier.id" style="width: 200px;" required=true data-options="required:true,panelHeight:'auto',valueField:'id',textField:'name',url:'/admin/supplier/comboList'"></select>-->
                        &nbsp;&nbsp;&nbsp;&nbsp;领料单位：<input type="text" id="deptName" name="lingliaodanwei" size="10"
                                                            readonly="readonly" onclick="openDeptListChoose()"
                                                            class="easyui-validatebox" required="true"/>
                        <input type="hidden" id="deptId"/>
                    </td>
                    <td>
                        &nbsp;&nbsp;&nbsp;&nbsp;出库库房：<input type="text" id="storeName" name="chkukufang" size="10"
                                                            readonly="readonly" onclick="openStoreListChoose()"
                                                            class="easyui-validatebox" required="true"/>
                        <input type="hidden" id="storeId"/>
                    </td>
                </tr>
                <tr>
                    <td>
                        领&nbsp;料&nbsp;人&nbsp;：<input type="text" id="lingliaoren" name="lingliaoren" size="10"
                                    class="easyui-validatebox"/>
                    </td>
                    <td>
                        &nbsp;&nbsp;&nbsp;&nbsp;发料人：<input type="text" id="faliaoren" name="faliaoren" size="10"
                                                           class="easyui-validatebox"/>
                    </td>
                    <td>
                        &nbsp;&nbsp;&nbsp;摘要：<input type="text" id="zhaiyao" name="zhaiyao" size="10"
                                  class="easyui-validatebox"/>
                    </td>
                </tr>
                <tr>
                    <td colspan="3">
                        备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注&nbsp;：<input type="text" size="58" id="beizhu" name="beizhu"/>
                    </td>
                    <td>
                        <input type="hidden" id="wuliaochukudanhao" name="wuliaochukudanhao"/>
                        <input type="hidden" id="wuliaoChukuDetailsJson" name="wuliaoChukuDetailsJson"/>
                        &nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:saveChukuDan()" class="easyui-linkbutton"
                                                   iconCls="icon-ok">保存</a>
                    </td>
                </tr>
            </table>
        </form>
    </fieldset>
</div>
<!--dg显示的是物料验收单的详细,也就是在下方添加验收单详细时的数据.-->
<div region="center" style="padding: 10px;border: 1px">
    <table id="dg" class="easyui-datagrid" style="height: 1200px"
           fitColumns="true" rownumbers="true" singleSelect="true"
           fit="true" toolbar="#tb">
        <thead>
        <tr>
            <th field="id" width="30" align="center" sortable="true" hidden="hidden">编号</th>
            <th field="dalei" width="35" align="center" sortable="true">大类</th>
            <th field="wuliaobianma" width="70" align="center" sortable="true">物料编码</th>
            <th field="mingchengguige" width="80" align="center" sortable="true">名称规格</th>
            <th field="kehuishou" width="40" align="center" sortable="true">回收</th>
            <th field="chukushuliang" width="40" align="center" sortable="true">出库数量</th>
            <th field="danwei" width="50" align="center" sortable="true">单位</th>
            <th field="chukukufang" width="40" align="center" sortable="true">出库库房</th>
            <th field="beizhu" width="40" align="center" sortable="true">备注</th>
            <th field="zongzhangid" width="50" align="center" sortable="true" hidden="hidden">总表id</th>
        </tr>
        </thead>
    </table>
    <div id="tb">
        <div style="padding: 2px">
            <a href="javascript:openChukudanDetailsAddDialog()" class="easyui-linkbutton" iconCls="icon-add"
               plain="true">添加</a>
            <a href="javascript:openChukudanDetailsModifyDialog()" class="easyui-linkbutton" iconCls="icon-edit"
               plain="true">修改</a>
            <a href="javascript:deleteChukuDetails()" class="easyui-linkbutton" iconCls="icon-remove"
               plain="true">删除</a>
        </div>
    </div>
</div>

<!--查询项目列表-->
<div id="projList" class="easyui-dialog" style="width:800px;height:460px;"
     closed="true" data-options="onClose:function(){$('#s_codeOrProjName').val('');}">
    <div class="easyui-layout" style="width:100%;height:100%;">

        <div region="north" style="height: 50px;">
            <div style="padding-top: 8px;padding-left: 40px;">
                &nbsp;项目名称：&nbsp;<input type="text" id="projSearch" size="30"
                                              onkeydown="if(event.keyCode==13) searchProj()"/>
                <a href="javascript:searchProj()" class="easyui-linkbutton" iconCls="icon-search" plain="true">搜索</a>
            </div>
        </div>
        <div region="west" style="width: 200px" title="项目分类" split="true" data-options="collapsible:false">
            <div style="overflow-x: auto; overflow-y: auto; height: 90%; width:98%;">
                <ul id="projTree" class="easyui-tree" style="padding: 10px"></ul>
            </div>
            <div style="position:absolute;bottom: 10px;left: 15px">
                <a href="javascript:saveProjChoose(1)" class="easyui-linkbutton" data-options="iconCls:'icon-ok'">选择</a>
                <!--<a id="del" href="javascript:deleteGoodsType()" class="easyui-linkbutton" data-options="iconCls:'icon-remove',disabled:true">删除</a>-->
            </div>
        </div>
        <div region="center">
            <table id="projNameList" title="项目列表" class="easyui-datagrid"
                   fitColumns="true" pagination="true" rownumbers="true" singleSelect="true"
                   url="/admin/dproject/getSelective" fit="true" toolbar="#tb4">
                <thead>
                <tr>
                    <th field="id" width="30" hidden=true align="center">编号</th>
                    <th field="xiangmumingcheng" width="150" align="center">项目名称</th>
                    <th field="createtime" width="90" align="left">创建时间</th>
                </tr>
                </thead>
            </table>
            <div id="tb4">
                <div>
                    <a href="javascript:saveProjChoose(2)" class="easyui-linkbutton" iconCls="icon-ok"
                       plain="true">选择</a>
                </div>
            </div>
        </div>
    </div>
</div>

<!--查询部门列表-->
<div id="deptList" class="easyui-dialog" style="width:800px;height:460px;"
     closed="true" data-options="onClose:function(){$('#s_codeOrDeptName').val('');}">
    <div class="easyui-layout" style="width:100%;height:100%;">

        <div region="north" style="height: 50px;">
            <div style="padding-top: 8px;padding-left: 40px;">
                &nbsp;部门名称：&nbsp;<input type="text" id="deptSearch" size="30"
                                              onkeydown="if(event.keyCode==13) searchDept()"/>
                <a href="javascript:searchDept()" class="easyui-linkbutton" iconCls="icon-search" plain="true">搜索</a>
            </div>
        </div>
        <div region="west" style="width: 200px" title="发料单位分类" split="true" data-options="collapsible:false">
            <div style="overflow-x: auto; overflow-y: auto; height: 90%; width:98%;">
                <ul id="deptTree" class="easyui-tree" style="padding: 10px"></ul>
            </div>
            <div style="position:absolute;bottom: 10px;left: 15px">
                <a href="javascript:saveDeptChoose(1)" class="easyui-linkbutton" data-options="iconCls:'icon-ok'">选择</a>
                <!--<a id="del" href="javascript:deleteGoodsType()" class="easyui-linkbutton" data-options="iconCls:'icon-remove',disabled:true">删除</a>-->
            </div>
        </div>
        <div region="center">
            <table id="deptNameList" title="发料单位列表" class="easyui-datagrid"
                   fitColumns="true" pagination="true" rownumbers="true" singleSelect="true"
                   url="/admin/dbumen/getSelective" fit="true" toolbar="#tb-bm">
                <thead>
                <tr>
                    <th field="id" width="30" hidden=true align="center">编号</th>
                    <th field="bumenmingcheng" width="150" align="center">单位名称</th>
                    <th field="createtime" width="90" align="left">创建时间</th>
                </tr>
                </thead>
            </table>
            <div id="tb-bm">
                <div>
                    <a href="javascript:saveDeptChoose(2)" class="easyui-linkbutton" iconCls="icon-ok"
                       plain="true">选择</a>
                </div>
            </div>
        </div>
    </div>
</div>

<!--查询仓库列表-->
<div id="storeList" class="easyui-dialog" style="width:800px;height:460px;"
     closed="true" data-options="onClose:function(){$('#s_codeOrStoreName').val('');}">
    <div class="easyui-layout" style="width:100%;height:100%;">

        <div region="north" style="height: 50px;">
            <div style="padding-top: 8px;padding-left: 40px;">
                &nbsp;仓库名称：&nbsp;<input type="text" id="storeSearch" size="30"
                                              onkeydown="if(event.keyCode==13) searchStore()"/>
                <a href="javascript:searchStore()" class="easyui-linkbutton" iconCls="icon-search" plain="true">搜索</a>
            </div>
        </div>
        <div region="west" style="width: 200px" title="仓库列表" split="true" data-options="collapsible:false">
            <div style="overflow-x: auto; overflow-y: auto; height: 90%; width:98%;">
                <ul id="storeTree" class="easyui-tree" style="padding: 10px"></ul>
            </div>
            <div style="position:absolute;bottom: 10px;left: 15px">
                <a href="javascript:saveStoreChoose()" class="easyui-linkbutton" data-options="iconCls:'icon-ok'">选择</a>
                <!--<a id="del" href="javascript:deleteGoodsType()" class="easyui-linkbutton" data-options="iconCls:'icon-remove',disabled:true">删除</a>-->
            </div>
        </div>
        <div region="center">
            <table id="storeNameList" title="仓库选择" class="easyui-datagrid"
                   fitColumns="true" pagination="true" rownumbers="true" singleSelect="true"
                   url="/admin/dkufang/getSelective" fit="true" toolbar="#tb5">
                <thead>
                <tr>
                    <th field="id" width="30" hidden=true align="center">编号</th>
                    <th field="kufangmingcheng" width="50" align="center">仓库名称</th>
                    <th field="createtime" width="150" align="left">创建时间</th>
                </tr>
                </thead>
            </table>
            <div id="tb5">
                <div>
                    <a href="javascript:saveStoreChoose()" class="easyui-linkbutton" iconCls="icon-ok"
                       plain="true">选择</a>
                </div>
            </div>
        </div>
    </div>
</div>

<!--选择物料时的弹出窗-->
<div id="dlg" class="easyui-dialog" style="width:1200px;height:460px;"
     closed="true" data-options="onClose:function(){$('#s_codeOrName').val('');}">
    <div class="easyui-layout" style="width:100%;height:100%;">

        <div region="north" style="height: 50px;">
            <div style="padding-top: 8px;padding-left: 40px;">
                &nbsp;物料编码：&nbsp;<input type="text" id="s_wuliaobianma" size="30"
                                        onkeydown="if(event.keyCode==13) searchGoods()"/>
                &nbsp;名称规格：&nbsp;<input type="text" id="s_mingchengguige" size="30"
                                        onkeydown="if(event.keyCode==13) searchGoods()"/>
                <a href="javascript:searchGoods()" class="easyui-linkbutton" iconCls="icon-search" plain="true">搜索</a>
            </div>
        </div>
        <div region="west" style="width: 200px" title="物料类别" split="true" data-options="collapsible:false">
            <div style="overflow-x: auto; overflow-y: auto; height: 90%; width:98%;">
                <ul id="tree" class="easyui-tree" style="padding: 10px"></ul>
            </div>
        </div>
        <div region="center">
            <table id="dg3" title="物料列表" class="easyui-datagrid"
                   fitColumns="true" pagination="true" rownumbers="true" singleSelect="true"
                   url="/admin/dwuliao/getSelective" fit="true" toolbar="#tb3">
                <thead>
                <tr>
                    <th field="id" align="center" sortable="true" hidden="hidden">编号</th>
                    <th field="dalei"  width=10% align="center" sortable="true">大类</th>
                    <th field="wuliaobianma" width=10% align="center" sortable="true">物料编码</th>
                    <th field="mingchengguige" width=20% align="center" sortable="true">名称规格</th>
                    <th field="danwei" width=10% align="center" sortable="true">单位</th>
                    <th field="kehuishou" width=10% align="center" sortable="true">可回收</th>
                    <th field="huishouxiang" width=10% align="center" sortable="true">回收项</th>
                    <th field="beizhu" width=10% align="center" sortable="true">备注</th>
                    <th field="founder" width=10% align="center" sortable="true">创建人</th>
                    <th field="createtime" width=10% align="center" sortable="true">创建时间</th>
                </tr>
                </thead>
            </table>
            <div id="tb3">
                <div>
                    <a href="javascript:openGoodsChooseDialog()" class="easyui-linkbutton" iconCls="icon-ok"
                       plain="true">选择</a>
                </div>
            </div>
        </div>
    </div>
</div>

<div id="dlg2" class="easyui-dialog" style="width:300px;height:120px;padding: 10px 20px"
     closed="true" buttons="	#dlg-buttons2" data-options="onClose:function(){$('#goodsTypeName').val('');}">

    <form id="fm" method="post">
        <div>
            物料类别：&nbsp;<input type="text" id="goodsTypeName" name="name" class="easyui-validatebox" required="true"/>
        </div>
    </form>
</div>

<div id="dlg-buttons2">
    <a href="javascript:saveGoodsType()" class="easyui-linkbutton" iconCls="icon-ok">保存</a>
    <a href="javascript:closeGoodsTypeDialog()" class="easyui-linkbutton" iconCls="icon-cancel">关闭</a>
</div>

<div id="dlg4" class="easyui-dialog" style="width:550px;height:465px;padding: 5px 5px"
     closed="true" buttons="#dlg-buttons4" data-options="onClose:function(){resetValue()}">

    <fieldset style="border-color: #E7F0FF">
        <legend>物料信息</legend>
        <form id="fm4" method="post">
            <table cellspacing="8px">
                <tr>
                    <td width="60">大类：</td>
                    <td><input type="text" id="dalei" name="dalei" size="10" readonly="readonly"/></td>
                    <td width="60">物料编码：</td>
                    <td><input type="text" id="wuliaobianma" name="wuliaobianma" size="10" readonly="readonly"/></td>
                </tr>
                <tr>
                    <td width="80">名称规格：</td>
                    <td><input type="text" id="mingchengguige" name="mingchengguige" size="10" readonly="readonly"/>
                    </td>
                    <td width="80">物料单位：</td>
                    <td><input type="text" id="danwei" name="danwei" size="10" readonly="readonly"/></td>
                </tr>
                <tr>
                    <td width="80">可回收：</td>
                    <td><input type="text" id="kehuishou" name="kehuishou" size="10" readonly="readonly"/>
                    <td width="80">回收项：</td>
                    <td><input type="text" id="huishouxiang" name="huishouxiang" size="10" readonly="readonly"/>
                </tr>
                <tr>
                    <td width="80">备注</td>
                    <td><input type="text" id="beizhu_dh" name="beizhu" size="10" readonly="readonly"/></td>
                </tr>
            </table>
        </form>
    </fieldset>
    <div style="padding-left: 12px;padding-top: 10px">
        <form id="fm5" method="post">
            <table cellspacing="8px">
                <td><input type="hidden" id="action"/><input type="hidden" id="rowIndex"/></td>
                <tr>
                    <td>出库数量：</td>
                    <td><input type="text" id="chukushuliang" name="chukushuliang" class="easyui-numberbox"
                               data-options="min:0,precision:3"
                               required="true" size="10"/></td>
                </tr>
                <tr>
                    <td>备注：</td>
                    <td><input type="text" id="beizhu_ck" name="beizhu" size="10" /></td>
                </tr>
            </table>
        </form>
    </div>
</div>

<div id="dlg-buttons4">
    <a id="saveAndAddNextBuuton" href="javascript:saveGoods(2)" class="easyui-linkbutton"
       iconCls="icon-ok">保存并新增下一物料</a>
    <a href="javascript:saveGoods(1)" class="easyui-linkbutton" iconCls="icon-ok">保存</a>
    <a href="javascript:closeGoodsChooseDialog()" class="easyui-linkbutton" iconCls="icon-cancel">关闭</a>
</div>


<!--大屏幕上右键datagrid dlg-->
<div id="grid-data" class="easyui-menu" style="width: 80px; display: none;">
    <div id="grid-data-edit" href="javascript:openChukudanDetailsModifyDialog()" data-options="iconCls:'icon-edit'">修改</div>
    <div id="grid-data-delete" href="javascript:deleteChukuDetails()" data-options="iconCls:'icon-remove'" plain="true">删除
    </div>
</div>
<!--二级菜单右键弹出-->
<div id="tree-2" class="easyui-menu" style="width: 80px; display: none;">
    <!--<div id="tree-2-delete" href="javascript:deleteType()" data-options="iconCls:'icon-remove'">删除二级菜单</div>-->
</div>
<!--一级菜单右键弹出-->
<div id="tree-1" class="easyui-menu" style="width: 80px; display: none;">
    <!--<div id="tree-1-add-2" href="javascript:openTypeAddDialog()" data-options="iconCls:'icon-add'">添加二级菜单</div>-->
    <!--<div id="tree-1-delete" href="javascript:deleteType()" data-options="iconCls:'icon-remove'">删除一级菜单</div>-->
</div>
<!--树形菜单右键弹出-->
<div id="tree-0" class="easyui-menu" style="width: 80px; display: none;">
    <!--<div id="tree-0-add-1" href="javascript:openTypeAddDialog(0)" data-options="iconCls:'icon-add'">添加一级菜单</div>-->
    <!--<div id="tree-0-refresh" href="javascript:reloadTree()" data-options="iconCls:'icon-reload'">重新加载类别</div>-->
</div>


</body>
</html>